<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>品牌-列表</title>
	<link rel="stylesheet" type="text/css" href="/static/layui/css/layui.css" />
	<link rel="stylesheet" type="text/css" href="/static/iconfont/iconfont.css"/>		
	<link rel="stylesheet" type="text/css" href="/static/plugins/webuploader/webuploader.css"/>
	<link rel="stylesheet" type="text/css" href="/static/common/common.css" />
	<style type="text/css">	
		.layui-table-body.layui-table-main tr .layui-table-cell{
			height: 130px;
   		    line-height: unset;
		}
		.image-list .item{	
		    height: 130px;		
		    margin: 0px;
		}
		.image-list .item .image-card{
			height: 62px;
		}
		.image-list .item img{
		    max-height: 80px;	
    		max-width: 108px;
		}
		.webuploader-pick{
		    height: 98px!important;
		    background: #f8f8f8 url(./../static/images/upload.png) center 18px no-repeat!important;
		}
		.image-list .layui-icon-delete{	
			position: relative;
    		bottom: -20px;
		}
		.image-container{
			margin-left: 0px;
		}	
	</style>
</head>
<body class="body-container">
	<input id="fileServiceLocation" type="hidden" th:value="${file_service_location}" />

	<div>
		<button type="button" class="layui-btn layui-btn-normal layui-btn-sm add-info-btn">添加品牌</button>
	</div>
	
	<!-- table表格数据 -->
	<div class="content-container">
		<table class="layui-hide" id="layerTable" lay-filter="layerTable"></table>
	</div>
	
	<script src="/static/jquery/jquery-2.1.1.min.js" type="text/javascript"></script>
	<script src="/static/layui/layui.all.js" type="text/javascript"></script>
	<script type="text/javascript" src="/static/plugins/webuploader/webuploader.js"></script>
	<script src="/static/common/common.js" type="text/javascript"></script>
	<script type="text/javascript" th:inline="none">		
		var fileServiceLocationVal = "";	
	
		$(document).ready(function() {		
			fileServiceLocationVal = $("#fileServiceLocation").val();
						
			layui.table.reload('layerTable',{url:table_url,page:{curr:1},where:{}});	
		})
		
		// table
		var table_url = '/brandInfo/selectPageList';	
		layui.use('table', function(){
	        var table = layui.table;
	        table.render({
	            elem: '#layerTable'	
	            //,url:'/sysMenu/selectPageInfoList'
				//,height:600
				,method:'post'
				,limit:10
				,limits:[10,20,30]
				,where: {}
	            ,request: {
	                pageName: 'currentPage' //页码的参数名称，默认：page
	                ,limitName: 'pageSize' 	//每页数据量的参数名，默认：limit
	            }
	            ,response: {		
	                statusName: 'code' 		//数据状态的字段名称，默认：code
	                ,statusCode: 200 		//成功的状态码，默认：0
	                ,msgName: 'msg' 		//状态信息的字段名称，默认：msg
	                ,countName: 'total'  	//数据总数的字段名称，默认：count
	                ,dataName: 'dataObject' //数据列表的字段名称，默认：data
				}	
	            ,cols: [[	
	            	 {type:'numbers'}
	            	,{field:'id',width:90, title: '编号'}
	            	,{field:'brandName',width:140, title: '品牌名称'}	
	            	,{field:'brandLogo',width:240, title: '品牌logo',templet:
	            		function(res){	
	            			var html = '';
	            			html+='<div class="image-container">';
	            			html+='<ul class="image-list">';
	            			html+='<li class="item">';
	            			html+='<div class="img-title mian">120 * 100</div>';
	            			
	            			html+='<div class="image-card image-sort'+res.id+'">';
	            			if(res.brandLogo){	            				
            					html+='<img class="picture-preview-btn" alt="url" src="'+fileServiceLocationVal+res.brandLogo+'">';
	            			}else{
	            				html+='<div id="fileList" class="uploader-list"></div>';	
            					html+='<div class="wb-file-pickers" image-sort='+res.id+' brand-id='+res.id+' onchange="webUploadsOnchange(\''+res.id+'\')"></div>';	
	            			}
	            			html+='</div>';		
	            			
	            			html+='<div class="image-tools image-sort'+res.id+'">';
            				if(res.brandLogo){ 	           					
	            				html+='<i class="layui-icon layui-icon-delete del-product-image" file-number="'+res.brandLogo+'" image-sort='+res.id+' brand-id='+res.id+'></i>';
            				}
            				html+='</div>';
           					
	            			html+='</li>';
	            			html+='</ul>';
	            			html+='</div>';
	            			return html;
	            		}
	            	}		
	            	,{field:'sort',width:100, title: '排序'}	      
	            	,{field:'initial',width:100, title: '首字母'}	    
	            	,{field:'hotSwitch',width:150, title: '开关',templet: 
	            		function(res){		
	            			var html = "";
	            			html+='<form class="layui-form" action="">';
	            			html+='<div class="layui-form-item" style="margin-bottom: 2px;">';		
	            			html+='<label class="layui-form-label" style="width: 50px; padding-left: 0px;">热门</label>';
	            			html+='<div class="layui-input-block" style="margin-left: 50px;line-height: 39px;">';
	            			if(res.hotSwitch==1){	            				
	            				html+='<input type="checkbox" checked="" lay-skin="switch" lay-filter="switchHotSwitch" lay-text="开启|关闭" value='+res.id+'>';
	            			}else{	
	            				html+='<input type="checkbox" lay-skin="switch" lay-filter="switchHotSwitch" lay-text="开启|关闭" value='+res.id+'>';	
	            			}	
	            			html+='</div>';
	            			html+='</div>';
	            			html+='</form>';

	           				return html;	
	            		}
	            	}
	                ,{field:'brandStatus',width:100, title: '品牌状态', templet:
	                	function(res){
	            			var html = "";
	            			if(res.brandStatus==1){	
	            				html = '<p style="color: #5fb878;">正常</p>';	
	            			}else if(res.brandStatus==2){
	            				html = '<p style="color: red;">停用</p>';
	            			}else{
	            				html = '<p>-</p>';
	            			}	
	            			html += '<button type="button" class="layui-btn layui-btn-normal layui-btn-xs edit-status-btn" brand-id='+res.id
	            			+' status='+res.brandStatus+' style="margin-top: 10px;height: 17px;line-height: 17px;"><i class="layui-icon layui-icon-edit"></i></button>';
	            			return html;
	            		}
	                }
	                ,{field:'description',width:220, title: '描述'}
	                ,{field:'createTime',width:220, title: '时间', templet:
	                	function(res){
	            			var html = "";
	            			html+='<p>创建： '+commonDateFormat(res.createTime,"yyyy-MM-dd hh:mm:ss")+' </p>';
	            			html+='<p>修改： '+commonDateFormat(res.updateTime,"yyyy-MM-dd hh:mm:ss")+' </p>';
	           				return html;	
	            		}
	                }
	                ,{field:'right',title: '操作', templet: 
	                	function(res){		
	                		var html = "";		
                			html += '<a class="layui-btn layui-btn-normal layui-btn-xs edit-info-btn" brand-id="'+res.id+'"><i class="layui-icon layui-icon-edit"></i>编辑</a>';
                			return html;	
	                	}
	                }		
	            ]]	
	            ,page: true
	            ,done: function(res, curr, count){	
	            	initWebUploader();
	            }
	        });  
    	});
			
		// 编辑
		$(document).on('click', '.edit-info-btn', function() {
			var brandId = $(this).attr("brand-id");
			var index = layer.open({				
				type: 1 ,				  		// 0（信息框，默认）1（页面层）2（iframe层）3（加载层）4（tips层
				title: "编辑",					// title: ['文本', 'font-size:18px;']，数组第二项可以写任意css样式；如果你不想显示标题栏，你可以title: false
				area: ['880px', '500px'],		// 默认：'auto' 	自适应
				//shade: 1,				  		// 要想显示遮罩需要将这个  注释							
				skin: 'layui-layer-lan',  		// layer内置的skin有：layui-layer-lan layui-layer-molv
				maxmin: true,
				resize:false,		
				shadeClose:false,					
				content:initEditInfoHtml(),					
				btn: ['立即保存','取消'], 	
				btn1: function(){			

				},
				btn2: function(){				
					layer.close(index);		
				},
				cancel: function(){ 

				},		
				success: function(layers){		
					var form = layui.form;
					layers.addClass('layui-form');	
					//	将按钮弄成能提交的
					layers.find('.layui-layer-btn0').attr('lay-filter', 'editInfoFrom').attr('lay-submit', '');
					
					// 根据id查询
					selectById(brandId);
					
					form.render(); 		
					form.on('submit(editInfoFrom)', function (data) {				
						data.field.brandId = brandId;	
						$.ajax({					
							url: '/brandInfo/updateInfo', 				// 请求的url地址	
							dataType: 'json', 						// 返回格式为json	
							data: data.field,	
							type: 'post', 							// 请求方式		
							async: false,	
							success: function (res) {
								if (res.code == 200) {
									layer.msg("保存成功");	
									layer.close(index);	
								}else{			
									layer.msg(res.msg);	
								}
							},		
							error: function () {

							}
						});
						return false;
					});	

				}	
			});
		})
		
		// 根据id查询
		function selectById(id){
			$.ajax({			
				url: '/brandInfo/getById', 				// 请求的url地址	
				dataType: 'json', 							// 返回格式为json	
				data: {'brandId':id},
				type: 'post', 								// 请求方式		
				success: function (res) {
					console.log(res);
					if(res.code==200){
						var objInfo = res.dataObject;
						$(".edit-info-from input[name='brandName']").val(objInfo.brandName);
						$(".edit-info-from input[name='sort']").val(objInfo.sort);
						$(".edit-info-from input[name='initial']").val(objInfo.initial);
						if(objInfo.description){							
							$(".edit-info-from textarea[name='description']").text(objInfo.description);
						}
					}else{
						layer.msg(res.msg);	
					}
				},		
				error: function () {

				}
			});
		}
		
		// 编辑 html
		function initEditInfoHtml(){
			var html = "";			
			html+='<div style="margin: 40px 20px;">';	
			html+='<form class="layui-form edit-info-from" action="">';
			
			html+='<div class="layui-form-item">';
			html+='<div class="layui-inline">';
			html+='<label class="layui-form-label zdy-required">品牌名称</label>';
			html+='<div class="layui-input-inline input-inline-width">';
			html+='<input type="tel" name="brandName" lay-verify="required" maxlength="14" placeholder="请输入名称" autocomplete="off" class="layui-input">';
			html+='</div>';
			html+='</div>';

			html+='<div class="layui-inline">';
			html+='<label class="layui-form-label zdy-required">排序</label>';
			html+='<div class="layui-input-inline input-inline-width">';
			html+='<input type="text" name="sort" onkeyup="numberFilter(this)" lay-verify="required" placeholder="请输入数字越小越靠前" maxlength="2"  autocomplete="off" class="layui-input">';
			html+='</div>';
			html+='</div>';
			html+='</div>';
			
			
			html+='<div class="layui-form-item">';
			html+='<div class="layui-inline">';
			html+='<label class="layui-form-label zdy-required">首字母</label>';
			html+='<div class="layui-input-inline input-inline-width">';
			html+='<input type="text" name="initial" onkeyup="englishFilter(this)" lay-verify="required" placeholder="请输入首字母" maxlength="2"  autocomplete="off" class="layui-input">';
			html+='</div>';
			html+='</div>';
			html+='</div>';
			
			html+='<div class="layui-form-item layui-form-text">';	
			html+='<label name="description" class="layui-form-label">备注</label>';
			html+='<div class="layui-input-block">';						
			html+='<textarea name="description" class="layui-textarea" placeholder=""></textarea>';		
			html+='</div>';	
			html+='</div>';		
			html+='</form>';
			html+='</div>';
			return html;
		}
		
		// 添加操作
		$(document).on('click', '.add-info-btn', function() {
			var index = layer.open({				
				type: 1 ,				  		// 0（信息框，默认）1（页面层）2（iframe层）3（加载层）4（tips层
				title: "添加",					// title: ['文本', 'font-size:18px;']，数组第二项可以写任意css样式；如果你不想显示标题栏，你可以title: false
				area: ['850px', '500px'],		// 默认：'auto' 	自适应
				//shade: 1,				  		// 要想显示遮罩需要将这个  注释							
				skin: 'layui-layer-lan',  		// layer内置的skin有：layui-layer-lan layui-layer-molv
				maxmin: true,
				resize:false,		
				shadeClose:false,					
				content:initAddInfoHtml(),					
				btn: ['立即添加','取消'], 	
				btn1: function(){			

				},
				btn2: function(){				
					layer.close(index);		
				},
				cancel: function(){ 

				},		
				success: function(layers){		
					var form = layui.form;
					layers.addClass('layui-form');	
					layers.find('.layui-layer-btn0').attr('lay-filter', 'addInfoFrom').attr('lay-submit', '');//将按钮弄成能提交的
					form.render(); 			
					form.on('submit(addInfoFrom)', function (data) {
						$.ajax({				
							url: '/brandInfo/addInfo', 				// 请求的url地址	
							dataType: 'json', 						// 返回格式为json	
							data: data.field,
							type: 'post', 							// 请求方式		
							async: false,	
							success: function (res) {
								if (res.code == 200) {
									layer.msg("添加成功");	
									layer.close(index);	
								}else{			
									layer.msg(res.msg);	
								}
							},		
							error: function () {

							}
						});	
						return false;
					});	

				}	
			});
		})
		
		
		// 添加  html
		function initAddInfoHtml(){
			var html = "";		
			html+='<div style="margin: 40px 20px;">';	
			html+='<form class="layui-form" action="">';
				
			html+='<div class="layui-form-item">';
			html+='<div class="layui-inline">';
			html+='<label class="layui-form-label zdy-required">品牌名称</label>';
			html+='<div class="layui-input-inline input-inline-width">';
			html+='<input type="tel" name="brandName" lay-verify="required" maxlength="14" placeholder="请输入名称" autocomplete="off" class="layui-input">';
			html+='</div>';
			html+='</div>';

			html+='<div class="layui-inline">';
			html+='<label class="layui-form-label zdy-required">排序</label>';
			html+='<div class="layui-input-inline input-inline-width">';
			html+='<input type="text" name="sort" onkeyup="numberFilter(this)" lay-verify="required" placeholder="请输入数字越小越靠前" maxlength="2"  autocomplete="off" class="layui-input">';
			html+='</div>';
			html+='</div>';
			html+='</div>';
						
			html+='<div class="layui-form-item">';
			html+='<div class="layui-inline">';
			html+='<label class="layui-form-label zdy-required">首字母</label>';
			html+='<div class="layui-input-inline input-inline-width">';
			html+='<input type="text" name="initial" onkeyup="englishFilter(this)" lay-verify="required" placeholder="请输入首字母" maxlength="2"  autocomplete="off" class="layui-input">';
			html+='</div>';
			html+='</div>';
			html+='</div>';
			
			html+='<div class="layui-form-item layui-form-text">';	
			html+='<label name="description" class="layui-form-label">说明</label>';
			html+='<div class="layui-input-block">';						
			html+='<textarea name="description" class="layui-textarea" placeholder=""></textarea>';		
			html+='</div>';	
			html+='</div>';		
			html+='</form>';
			html+='</div>';
			return html;
		}
		
		var brandIdVal;
		var imageSortVal;
		// 自定义属性值 
		function webUploadsOnchange(id) {   	         
			brandIdVal = id;   
		}
		// 初始化 图片文件上传 webUploaderObj
	    var webUploaderObj = null;
	    function initWebUploader() {		
	    		// 初始化Web Uploader	 	  
		        webUploaderObj = WebUploader.create({
		        auto: true,							// 选完文件后，是否自动上传。
		        // swf文件路径
		        swf: './../static/plugins/webuploader/Uploader.swf',
		        // 文件接收服务端。
		        server: '/upload/brandLogo',
		        // 内部根据当前运行是创建，可能是input元素，也可能是flash.
		        pick: '.wb-file-pickers',    
		        // 只允许选择图片文件。
		        accept: {
		            title: 'Images',
		            extensions: 'gif,jpg,jpeg,bmp,png',
		            mimeTypes: 'image/*'
		        },  			
		        fileVal:"file", 						// [默认值：'file'] 设置文件上传域的name。  
		        fileNumLimit: 1, 						//限制上传个数
		        fileSingleSizeLimit: 2048000, 			//限制单个上传图片的大小
		        compress: false, 						//webuploader默认压缩图片,设置compress:false，可以按照原始比例上传图
				chunked: false, 						//是否要分片处理大文件上传  
				duplicate: false, 						//是否支持重复上传 	 
				fileSizeLimit: 1 * 1024 * 1024 			// 2000 * 1024 * 1024 最大2GB   
				//chunkSize:2*1024*1024, 				//分片上传，每片2M，默认是5M
		    });
		 	// 验证文件格式以及文件大小 
			webUploaderObj.on("error", function (type,file) {
				if (type == "Q_TYPE_DENIED") {
					layer.msg("文件格式不支持");
				} else if (type == "Q_EXCEED_SIZE_LIMIT") {
					layer.msg("文件大小不能超过200M");
				}else if(type == "Q_EXCEED_NUM_LIMIT"){
					layer.msg("超过每次上传数量图片限制");
				}else if(type == "F_DUPLICATE"){
					layer.msg("文件重复");  
				} else {         
					layer.msg("上传出错！错误代码"+type);
				} 
			});     
			// 上传前验证   
			webUploaderObj.on('beforeFileQueued', function (file) {
				if(brandIdVal){       
					layer.msg("文件正在上传,上传完毕后再进行上传");	
					return;  	 
				}   
			});
			// 当有文件添加进来的时候
		    webUploaderObj.on( 'fileQueued', function( file , req) {
		    	
		    	
		    });
			// 文件上传前处理请求参数   
			webUploaderObj.on('uploadBeforeSend', function (obj, data) {
				//传入表单参数          	
				data.brandId = brandIdVal; 
			});     
		    // 文件上传过程中创建进度条实时显示。
		    webUploaderObj.on( 'uploadProgress', function( file, percentage ) {
		
		    });
		    // 文件上传成功
		    webUploaderObj.on( 'uploadSuccess', function( file ,res) {
		    	if(res.code==200){		
					if(res.dataObject){	
						// 显示上传图片								
						$(".image-container .image-card.image-sort"+brandIdVal).empty().append('<img class="picture-preview-btn" src="'+res.dataObject.fileUrl+'">');
						// 显示删除							
						var html2 = '<i class="layui-icon layui-icon-delete del-product-image" file-number="'+res.dataObject.number+'" brand-id='+brandIdVal+' image-sort='+brandIdVal+'></i>';
						$(".image-container .image-tools.image-sort"+brandIdVal).empty().append(html2);		
						layer.msg("上传成功");						
					}else{			
						layer.msg(res.msg);	
					}
				}else{
					layer.msg(res.msg);
				}	
				webUploaderObj.reset();		        
		    }); 
		 	// 上传失败回调
		    webUploaderObj.on( 'uploadError', function( file ) {
					
		    });
		 	// 不管上传成功还是失败都会执行
		    webUploaderObj.on( 'uploadComplete', function( file ) {
		    			
		    });	
	    }
	    
	 	// 删除图片
	 	$(document).on('click', '.del-product-image', function () {	
	 		var fileName = $(this).attr("file-number");
	 		var brandId = $(this).attr("brand-id");
	 		var imageSort = $(this).attr("image-sort");
			layer.confirm('确定删除图片吗？', {
				btn: ['确定', '取消']		//按钮
			}, function (index) {
				$.ajax({	    	
			        url: '/upload/deleteBrandLogo',  		// 请求的url地址	
			        dataType: 'json', 					        // 返回格式为json	
			        data: {'brandId':brandId,'fileName':fileName},                             
			        type: 'post', 						        // 请求方式		
			        success: function (res) {
			           if(res.code==200){		
				        	layer.close(index);		
				        	// 显示上传按钮			
							$(".image-container .image-card.image-sort"+imageSort).empty().append('<div id="fileList" class="uploader-list "></div><div class="wb-file-pickers" image-sort='+imageSort+' brand-id='+brandId+' onchange="webUploadsOnchange(\''+brandId+'\')"></div>');
							// 清空删除						
							$(".image-container .image-tools.image-sort"+imageSort).empty().append("");	
							initWebUploader();				
							//webUploaderObj.reset();						
							$(".webuploader-pick").css("padding","initial");
			           }else{
			        	   layer.msg(res.msg);	
			           }
			        },
			        error: function () {

			        }	    
			    });
			});
		});
	 	
	 	// 编辑产品状态 edit-status-btn
		$(document).on('click', '.edit-status-btn', function () {
			var brandId = $(this).attr("brand-id")
			var statusVal = $(this).attr("status")
			var html = "";				
			html+='<div style="margin: 40px 20px;">';	
			html+='<form class="layui-form" action="">';
			
			html+='<div class="layui-form-item">';
			html+='<div class="layui-inline">';
			html+='<label class="layui-form-label zdy-required">品牌状态</label>';
			//  1、正常   2、停用
			html+='<div class="layui-input-inline">';
			html+='<select name="brandStatus" lay-verify="required" lay-search="">';
			html+='<option value="1" '+("1"==statusVal?"selected":"")+'>正常</option>';	
			html+='<option value="2" '+("2"==statusVal?"selected":"")+'>停用</option>';	
	 		html+='</select>';					
	 		html+='</div>';
	 		html+='</div>';
	 		html+='</div>';
			
			html+='</form>';
			html+='</div>';
			
			var index = layer.open({				
				type: 1 ,				  		// 0（信息框，默认）1（页面层）2（iframe层）3（加载层）4（tips层
				title: "修改状态",					// title: ['文本', 'font-size:18px;']，数组第二项可以写任意css样式；如果你不想显示标题栏，你可以title: false
				area: ['470px', '380px'],		// 默认：'auto' 	自适应
				//shade: 1,				  		// 要想显示遮罩需要将这个  注释							
				skin: 'layui-layer-lan',  		// layer内置的skin有：layui-layer-lan layui-layer-molv
				maxmin: true,
				resize:false,		
				shadeClose:false,					
				content:html,					
				btn: ['立即保存','取消'], 	
				btn1: function(){			

				},
				btn2: function(){				
					layer.close(index);		
				},
				cancel: function(){ 

				},		
				success: function(layers){		
					var form = layui.form;
					layers.addClass('layui-form');	
					layers.find('.layui-layer-btn0').attr('lay-filter', 'updateStatusFrom').attr('lay-submit', '');//将按钮弄成能提交的
					form.render(); 			
					form.on('submit(updateStatusFrom)', function (data) {
						data.field.brandId = brandId;
						$.ajax({				
							url: '/brandInfo/updateStatus', 				// 请求的url地址	
							dataType: 'json', 						// 返回格式为json	
							data: data.field,
							type: 'post', 							// 请求方式		
							async: false,	
							success: function (res) {
								if (res.code == 200) {
									layer.msg("修改成功");	
									layer.close(index);	
									layui.table.reload('layerTable',{url:table_url,page:{curr:1},where:{}});	
								}else{				
									layer.msg(res.msg);	
								}
							},		
							error: function () {

							}
						});	
						return false;
					});	

				}	
			});
		})
		
		layui.use('form', function () {
			var form = layui.form;	
			form.on('switch(switchHotSwitch)', function (data) {
				var contentStr = "开启热门吗?";
				var brandId = data.value;
				// 取消新品
				var x=data.elem.checked;
				if(x==false){
					contentStr = "取消热门吗?";
				}
	            layer.open({
	                content: contentStr
	                ,btn: ['确定', '取消']
	                ,yes: function(index, layero){
	                    data.elem.checked=x;
	                    $.ajax({
	    					url: '/brandInfo/updateHotSwitch',  		// 请求的url地址	
	    					dataType: 'json', 					// 返回格式为json	
	    					data: {'brandId':brandId,'switchs':x},
	    					type: 'post', 						// 请求方式		
	    					async: false,	
	    					success: function (res) {
	    						if (res.code == 200) {	
	    							layer.msg("操作成功");	
	    							form.render();
	    		                    layer.close(index);
	    		                    //按钮【按钮一】的回调
	    						} else {
	    							layer.msg(res.msg);
	    							data.elem.checked=!x;
    			                    form.render();	
    			                    return false //开启该代码可禁止点击该按钮关闭
	    						}
	    					},	
	    					error: function () {

	    					}
	    				});
	                }
	                ,btn2: function(index, layero){
	                    //按钮【按钮二】的回调
	                    data.elem.checked=!x;
	                    form.render();
	                    layer.close(index);
	                    return false //开启该代码可禁止点击该按钮关闭
	                }
	                ,cancel: function(){
	                    //右上角关闭回调
	                    data.elem.checked=!x;
	                    form.render();
	                    return false //开启该代码可禁止点击该按钮关闭
	                }
	            });
			});
		})
	</script>
</body>
</html>